//package com.topscomm.main.config;
//
//import com.topscomm.basic.BaseDataSource;
//import com.topscomm.tap.mybatis.SqlSessionFactoryBean;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.SqlSessionTemplate;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//
//@Configuration
//public class DataSourceConfigLtc {
//	@Value("${DefaultDataBaseTypeName}")
//	private String defaultDataBaseTypeName;
//
//	@Bean(name = "LTCDataSource")
//	@ConfigurationProperties(prefix = "spring.datasource.druid.ltc")
//	public DataSource dataSource() {
//		return new BaseDataSource();
//	}
//
//	@Bean(name = "LTCSqlSessionFactory")
//	public SqlSessionFactory sqlSessionFactory(@Qualifier("LTCDataSource") DataSource dataSource) throws Exception {
//		SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
//		bean.setDataSource(dataSource);
//		bean.setMapperLocations(new PathMatchingResourcePatternResolver()
//				.getResources("classpath*:config/mybatis/*/" + defaultDataBaseTypeName + "/**/ibatis_*.xml"));
//		bean.setConfigLocation(new PathMatchingResourcePatternResolver()
//				.getResource("classpath:config/mybatis/" + defaultDataBaseTypeName + "/sqlMapConfig.main.xml"));
//		return bean.getObject();
//	}
//
//	@Bean(name = "LTCTransactionManager")
//	public DataSourceTransactionManager transactionManager(@Qualifier("LTCDataSource") DataSource dataSource) {
//		return new DataSourceTransactionManager(dataSource);
//	}
//
//	@Bean(name = "LTCSqlSessionTemplate")
//	public SqlSessionTemplate sqlSessionTemplate(@Qualifier("LTCSqlSessionFactory") SqlSessionFactory sqlSessionFactory)
//			throws Exception {
//		return new SqlSessionTemplate(sqlSessionFactory);
//	}
//}
